#ifndef _PATTERN_INTERPOLATION_H_
#define _PATTERN_INTERPOLATION_H_

#include "Common.h"

typedef unsigned char imgpel;

//const int HORIZONTAL_SKIP_COUNT = 3;
//const int VERTICAL_SKIP_COUNT = 2;
//const int FLAT_THRESHOLD_VALUE = 20;
//const int REF_PIXEL_NUMBER = 20;
//
const int REF_4TAP_COFF[4] = { -4, 15, 15, -4 };
const int REF_4TAP_COFF_SUM = 22;
const int REF_4TAP_PIXEL_MATRIX[4] = { -3, -1, 1, 3 };

const int REF_6TAP_COFF[6] = { 1, -5, 20, 20, -5, 1 };
const int REF_6TAP_COFF_SUM = 32;
const int REF_6TAP_PIXEL_MATRIX[6] = { -5, -3, -1, 1, 3, 5 };
//
//const int NORMAL_TEST_BIT = 0x80000;
//const int PATTERN_VALID_BITMASK = 0xFFFFF;

imgpel InterpolatePixelWithPattern(imgpel ** full_rec, int width, int height, int i, int j, int mb_x, int mb_y );
bool GetRefPixelArray( int x, int y, unsigned char * ref_pixel_array, imgpel ** frame );
unsigned char ComputeInterpolationPixel( unsigned char * ref_pixel_array, char * coff_array );
unsigned char Compute4TapInterpolation( unsigned char * ref_pixel_array );
unsigned char Compute6TapInterpolation( unsigned char * ref_pixel_array );
bool Get4TapRefPixelArray( int x, int y, unsigned char * ref_pixel_array, imgpel ** frame );
unsigned int PatternArrayToInt( char * pattern_array );
bool PatternIntToArray( unsigned int pattern, char * pattern_array );
unsigned int NormalizePatternForm( unsigned int pattern );
bool CheckAreaFlat( unsigned char * ref_pixel_array );
bool BinarizeRefPixelArray( char * pattern_array, unsigned char * ref_pixel_array );

#endif // _PATTERN_INTERPOLATION_H_